added samples
[windows-sources.git] / sdk / samples / all in on code / Visual Studio 2010 / VBASPNETSearchEngine / Show.aspx.vb
blob42fadadc78c817e7b98288f17a1b247acf86a625
1 '****************************** Module Header ******************************\
2 ' Module Name: Show.aspx.vb
3 ' Project: VBASPNETSearchEngine
4 ' Copyright (c) Microsoft Corporation
6 ' This page shows an individual record from database according to Query String
7 ' parameter "id".
8 '
9 ' This source is subject to the Microsoft Public License.
10 ' See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL.
11 ' All other rights reserved.
13 '*****************************************************************************/
15 Partial Public Class Show
16 Inherits System.Web.UI.Page
17 ''' <summary>
18 ''' The record which is displaying.
19 ''' </summary>
20 Protected Data As Article
22 Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
23 Dim id As Long = 0
25 ' Only query database in the first load and ensure the input parameter is valid.
26 If Not IsPostBack _
27 AndAlso Not String.IsNullOrEmpty(Request.QueryString("id")) _
28 AndAlso Long.TryParse(Request.QueryString("id"), id) Then
29 Dim dataAccess As New DataAccess()
30 Data = dataAccess.GetArticle(id)
31 End If
33 ' Ensure the result is not null.
34 If Data Is Nothing Then
35 Data = New Article()
36 End If
37 End Sub
38 End Class